import http from './service'
// 封装get、post方法

export const GET = (url: string, params?: any) => {
    params = params || {};
    return new Promise((resolve, reject) => {
        http.get(url, { params })
            .then(res => { resolve(res.data) })
            .catch(err => { reject(err) })
    })
}

export const POST = (url: string, data?: any) => {
    data = data || {}
    return new Promise((resolve, reject) => {
        http.post(url, data)
            .then(res => { resolve(res.data) })
            .catch(err => { reject(err) })
    })
}